IdeaBlade.EntityModel.Compat Assembly > IdeaBlade.EntityModel.Compat Namespace > EntityScalarQueryAsyncExtensions Class > First Method : First<TResult>(IEntityScalarQuery<TResult>,Expression<Func<TResult,Boolean>>,Action<EntityScalarQueryOperation<TResult>>,Object) Method |
'Declaration
<ExtensionAttribute()> Public Overloads Shared Function First(Of TResult)( _ ByVal source As IEntityScalarQuery(Of TResult), _ ByVal predicate As Expression(Of Func(Of TResult,Boolean)), _ ByVal userCallback As Action(Of EntityScalarQueryOperation(Of TResult)), _ Optional ByVal userState As Object _ ) As EntityScalarQueryOperation(Of TResult)
'Usage
Dim source As IEntityScalarQuery(Of TResult) Dim predicate As Expression(Of Func(Of TResult,Boolean)) Dim userCallback As Action(Of EntityScalarQueryOperation(Of TResult)) Dim userState As Object Dim value As EntityScalarQueryOperation(Of TResult) value = EntityScalarQueryAsyncExtensions.First(Of TResult)(source, predicate, userCallback, userState)
public void AsyncFirstWithPredicate() { var op = _entityManager.Employees.AsScalarAsync().First(e => e.LastName.StartsWith("D")); op.Completed += (o, e) => { var emp = e.Result; }; }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2